﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Daphne.Modularity
{
    /// <summary>
    /// Represents the list of modules
    /// </summary>
    public class ModuleCatalog
    {
        private List<Type> _modules;

        /// <summary>
        /// Constructor
        /// </summary>
        public ModuleCatalog()
        {
            _modules = new List<Type>();
        }

        /// <summary>
        /// Module count property
        /// </summary>
        public int Count
        {
            get
            {
                return _modules.Count;
            }
        }

        /// <summary>
        /// Registers the module
        /// </summary>
        public void Register<T>() where T : IModule
        {
            _modules.Add(typeof(T));
        }

        /// <summary>
        /// Module Type Indexer
        /// </summary>
        public Type this[int index]
        {
            get
            {
                return _modules[index];
            }
        }
    }
}
